/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
var setZeroes = function (matrix) {
  let xlen = matrix.length;
  if (xlen === 0) return matrix;
  let ylen = matrix[0].length;
  let myTempArr = [];
  for (let i = 0; i < xlen; i++) {
    for (let j = 0; j < ylen; j++) {
      if (matrix[i][j] === 0) {
        myTempArr.push([i, j]);
      }
    }
  }

  for (let i = 0; i < myTempArr.length; i++) {
    for (let j = 0; j < xlen; j++) {
      matrix[j][myTempArr[i][1]] = 0;
    }
    for (let j = 0; j < ylen; j++) {
      matrix[myTempArr[i][0]][j] = 0;
    }
  }
};
